package Airport;
/**
 * @author Rodrigo
 */

import javax.swing.JOptionPane;
import sun.util.logging.resources.logging;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;

import static Util.Constantes.LOG_AIRPOT_FILENAME;
import static Util.Constantes.LOG_MAIN_FILENAME;
import static Util.Constantes.LOG_PATH;
import static Util.Constantes.SYSTEM_REQUIRED;

import Ambient.God;
import Airport.Airport;
import Airport.Controlador;
import Util.GravaLog;

public class main {
	private static GravaLog log = new GravaLog();
	
	/**
	 * 
	 * @param args String[]
	 *  - passe o path caso queira criar os logs em outro lugar
	 */
	public static final void main (String[] args)
	{
		String SO;
		//Lista todas as propriedades do sistema
		//System.getProperties().list(System.out);
		
		SO = System.getProperty("os.name");
		if (!SO.equalsIgnoreCase(SYSTEM_REQUIRED))
		{
			log.logErro("Sistema operacional incopativel com este programa.");
			log.logErro("Sistema operacional requerido: 'Windows XP'");
			BufferedReader in = new BufferedReader(new InputStreamReader(System.in));
			try {
				SO = in.readLine();
			} catch (IOException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			System.exit(0);
		}
		else
		{
			if(args.length == 0)
			{
				log.logInfo(LOG_MAIN_FILENAME, "Iniciando modo completo.");
				
				//inicia aeroporto
				Thread airport = new Airport();
				airport.start();
			}
			else
			{
				if (args.length > 0)
				{
					LOG_PATH = args[0];
					System.out.println("Path > " + LOG_PATH);
				}
				log.logInfo(LOG_MAIN_FILENAME, "Iniciando modo completo.");
				
				//inicia aeroporto
				Thread airport = new Airport();
				airport.start();
			}
		}
	}

}
